<?php
$kecheng = $_REQUEST["kecheng"];
$kecheng_sn = $_REQUEST["kecheng_sn"];
echo "kecheng";
echo "kecheng_sn";

// 四大步
//1.使用账户密码连接数据库服务
$host="localhost";
$user="root";
$password="168168";
$db="student_dbs";
$conn=mysqli_connect($host,$user,$password);
//2.选择要操作的数据库
mysqli_select_db($conn,$db);
// 设置数据库的字符编码，防止乱码
mysqli_query($conn,"set names utf8");

//3.运行sql语句，执行增、删、改、查
$sql1 = "insert into `课程`(课程编号,课程名称)value('{$kecheng}','{$kecheng}')";
$result = mysqli_query($conn,$sql1);
if($result){
    echo "<script>alert('数据插入成功')</script>";
    header("Refresh:1;url=02-index.html");
}else{
    echo "<script>alert('数据插入失败')</script>";
}
//4.关闭连接，释放资源
mysqli_close($conn);

?>